package com.company;

public class Vehicle {
    private String brand;
    private String color;
    private double speed;

    public Vehicle(String brand, String color) {
        this.brand = brand;
        this.color = color;
        this.speed = 0;
    }
    //获取汽车品牌
    public String getBrand() {
        return brand;
    }
    //获取汽车颜色
    public String getColor() {
        return color;
    }
    //获取汽车速度
    public double getSpeed() {
        return speed;
    }
    //设置汽车速度
    public void setSpeed(double speed) {
        this.speed = speed;
    }
    //设置汽车品牌，禁止外部访问
    private void setBrand(String brand) {
        this.brand = brand;
    }
    //设置汽车颜色，禁止外部访问
    private void setColor(String color) {
        this.color = color;
    }

    public void run(){
        System.out.println(getBrand() + "正在以" + getSpeed() + "Km/h的速度行驶");
    }
}
